<template>
    <div class="tree-box-content">
        <div class="tree-chart-box">
            <vue2-org-tree :data="data" :horizontal="true" @on-node-click="NodeClick" :renderContent="renderContent" />
        </div>

    </div>
</template>
<script>
import store from '@/store'
export default {
    components: {
    },
    data() {
        return {
            data: {
                id: 0,
                label: `黑龙江省营商环境建设监督局`,
                children: [
                    {
                        id: 2,
                        label: "内设机构",
                        children: [
                            { label: "机关党委" },
                            { label: "办公室" },
                            { label: "政策法规处" },
                            { label: "放管服改革协调处" },
                            { label: "政务服务管理处" },
                            { label: "大数据建设管理处" },
                            { label: "社会信用体系建设处" },
                            { label: "监督处" },
                            { label: "考核评价指导处" },
                            { label: "人事处" },
                        ]
                    },
                    {
                        id: 3,
                        label: "直属单位",
                        children: [
                            {
                                label: "黑龙江省公共信用中心",
                                children: [
                                    { label: "信息应用科" },
                                    { label: "信息技术科" },
                                    { label: "信用公示科" },
                                ]
                            },
                            {
                                label: "黑龙江省政务大数据中心",
                                children: [
                                    { label: "机关党委办公室" },
                                    { label: "办公室" },
                                    { label: "综合计划处" },
                                    { label: "基础设施处" },
                                    { label: "网络安全处" },
                                    { label: "技术标准处(电子认证服务中心)" },
                                    { label: "数据资源管理处" },
                                    { label: "数据分析应用处" },
                                    { label: "政务平台处" },
                                    { label: "合作交流与创新发展处" },
                                    { label: "技术服务处" },
                                    { label: "技术服务二处" },
                                    { label: "技术服务三处" },
                                    { label: "人事培训处" },
                                    { label: "12345热线服务处" },
                                    { label: "政务云服务处" },
                                    { label: "监测数据服务处" },
                                    { label: "工会" },
                                ]
                            },
                        ]
                    }
                ]
            },
        }
    },
    mounted() {
    },
    methods: {
        renderContent(h, data) {
            return h('div', {
                class: {
                    'firstName': data.label == '黑龙江省营商环境建设监督局',
                    'secondName': data.label == '内设机构' || data.label == '直属单位',
                    'otherName': data.label != '内设机构' && data.label != '直属单位' && data.label != '黑龙江省营商环境建设监督局',
                }
            },
                data.label
            );
        },
        //点击节点
        NodeClick(e, data) {
            if (data.label !== '内设机构' && data.label !== '直属单位') {
                this.goTable(data.label == '黑龙江省营商环境建设监督局' ? '' : data.label)
            }
        },
        goTable(customerName) {
            let loginCode = store.getters.loginCode
            this.$router.push({ path: '/governmentTable', query: { customerName, loginCode: loginCode } });
        },
    }
}
</script>
<style lang="scss" scoped>
.tree-box-content {
    position: relative;

    .pie-box-right {
        top: 40px;
        right: 20px;
    }
}
</style>